﻿using GamFi.Admin.API.Application.Contracts.Transaction.GetTransactions;
using GamFi.Admin.API.Application.Features.Queries.Transaction.GetTransactions;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GamFi.Admin.API.WEB.Controllers;

[Authorize]
[ApiController]
[Route("api/[controller]")]
public class TransactionController(IMediator mediator): ControllerBase
{
    /// <summary>
    /// Покупка токена
    /// </summary>
    /// <param name="request"></param>
    /// <param name="cancellationToken"></param>
    [HttpGet("GetTransactions")]
    public async Task<GetTransactionsResponse> GetPurchases([FromQuery] GetTransactionsRequest request, CancellationToken cancellationToken)
        => await mediator.Send(new GetTransactionsQuery(request), cancellationToken);
}